<!-- 取消退换票 -->
<template>
  <el-dialog
    :title="dialogTitle"
    :visible.sync="visible"
    width="800px"
    @close="handleClose"
  >
    <div class="dialog-content">
      <!-- 退换票信息展示 -->
      <div class="apply-info-container">
        <h3>退换票申请信息</h3>
        <div class="info-grid">
          <div class="info-item">
            <span class="label">发票种类：</span>
            <span class="value">
              <span>{{
                dict.invoice_category[Number(exchangeInfo.invoiceCategory)]
              }}</span>
            </span>
          </div>
          <div class="info-item">
            <span class="label">发票类型：</span>
            <span class="value">
              <span>{{
                dict.invoice_type[Number(exchangeInfo.invoiceType)]
              }}</span>
            </span>
          </div>
          <div class="info-item">
            <span class="label">姓名：</span>
            <span class="value">{{ exchangeInfo.studentName }}</span>
          </div>
          <div class="info-item">
            <span class="label">身份证号：</span>
            <span class="value">{{ exchangeInfo.idNumber }}</span>
          </div>
          <div class="info-item">
            <span class="label">单位：</span>
            <span class="value">{{ exchangeInfo.unitName }}</span>
          </div>
          <div class="info-item">
            <span class="label">单位统一信用代码：</span>
            <span class="value">{{ exchangeInfo.socialCreditCode }}</span>
          </div>
          <div class="info-item">
            <span class="label">联系方式：</span>
            <span class="value">{{ exchangeInfo.phonenumber }}</span>
          </div>
          <div class="info-item">
            <span class="label">发票金额：</span>
            <span class="value">{{ exchangeInfo.invoiceAmount }}</span>
          </div>
          <div class="info-item">
            <span class="label">发票编号：</span>
            <span class="value">{{ exchangeInfo.invoiceNumber }}</span>
          </div>
          <div class="info-item">
            <span class="label">申请原因：</span>
            <span class="value">{{ exchangeInfo.invoiceRefundReason }}</span>
          </div>
        </div>
      </div>

      <div class="confirm-message">确定取消该退换票申请？</div>
    </div>

    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取消</el-button>
      <el-button type="primary" @click="handleConfirm">提交</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "CancelExchangeDialog",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    exchangeInfo: {
      type: Object,
      default: () => ({}),
    },
    dict: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      dialogTitle: "取消退换票",
    };
  },
  methods: {
    handleClose() {
      this.$emit("close");
    },
    handleConfirm() {
      this.$emit("confirm");
    },
  },
};
</script>

<style scoped>
.dialog-content {
  padding: 20px;
}

.apply-info-container {
  border: 1px solid #dcdfe6;
  padding: 20px;
  margin-bottom: 20px;
}

.apply-info-container h3 {
  margin-top: 0;
  color: #303133;
  font-size: 16px;
  margin-bottom: 15px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.label {
  font-weight: bold;
  min-width: 120px;
  color: #909399;
}

.value {
  flex: 1;
  color: #303133;
}

.confirm-message {
  font-size: 16px;
  color: #333;
  margin: 30px 0;
  font-weight: 500;
  text-align: center;
}

.dialog-footer {
  text-align: right;
}
</style>